<template>
  <div>
    <el-form :model="queryParam" :inline=true style="display: flex">
      <el-form-item label="服务id">
        <el-input v-model="queryParam.serviceId" style="width:160px"/>
      </el-form-item>
      <el-form-item label="接口code">
        <el-input v-model="queryParam.sourceId" style="width:160px"/>
      </el-form-item>
      <el-form-item label="接口名">
        <el-input v-model="queryParam.sourceName" style="width:160px"/>
      </el-form-item>
      <el-form-item label="渠道名">
        <el-input v-model="queryParam.channelId" style="width:160px"/>
      </el-form-item>
      <el-form-item label="响应配置">
        <el-input v-model="queryParam.responseFormatJson" style="width:160px"/>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="queryPage">搜索</el-button>
      </el-form-item>
    </el-form>
    <el-table :data="tableData" stripe style="width: 100%">

      <el-table-column prop="serviceId" label="服务id" width="50"></el-table-column>
      <el-table-column label="详情" width="300">
        <template slot-scope="scope">
          <div class="typeEnter">接口code：{{ scope.row.sourceId }}</div>
          <div class="typeEnter">sourceName：{{ scope.row.sourceName }}</div>
          <div class="typeEnter">渠道名：{{ scope.row.channelId }}</div>
          <div class="typeEnter">计费表达式：{{ scope.row.payExpression }}</div>
        </template>
      </el-table-column>
      <el-table-column label="参数">
        <template slot-scope="scope">
          <div class="typeEnter">请求配置：{{ scope.row.requestJarConfig }}</div>
          <div class="typeEnter">响应配置：{{ scope.row.responseFormatJson }}</div>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="pageTotal>0"
      :total="pageTotal"
      :page.sync="queryParam.pageNum"
      :limit.sync="queryParam.pageSize"
      @pagination="queryPage"
    />
  </div>
</template>
<script>

export default {
  data() {
    return {
      // 查询参数
      pageTotal: 0,
      queryParam: {
        serviceId: '',
        sourceName: '',
        channelId: '',
        sourceId: '',
        responseFormatJson: '',
        requestJarConfig: '',
        pageNum: 1,
        pageSize: 10
      },
      tableData: []
    }
  },
  mounted() {
    this.pageList()
  },
  methods: {
    queryPage() {
      var _this = this
      _this.pageList()
    },
    pageList() {
      var _this = this
      this.$api.channelsourceinfoPageList(_this.queryParam).then(res => {
        if (res.code === '00000') {
          _this.tableData = res.data.pageList
          _this.pageTotal = res.data.pageTotal
        } else {
          _this.$message(res.msg)
        }
      }).catch(e => {
        console.log('接口访问异常!')
      })
    }
  }
}
</script>
